//
//  LFBClickProductView.m
//  loveFreshBeen
//
//  Created by Feng on 2017/7/10.
//  Copyright © 2017年 feng. All rights reserved.
//

#import "LFBClickProductView.h"

@interface LFBClickProductView ()

@property (weak, nonatomic) IBOutlet UILabel *buyProductNums;

@end

@implementation LFBClickProductView

+ (instancetype)clickProductView
{
    return [[NSBundle mainBundle] loadNibNamed:@"LFBClickProductView" owner:nil options:nil].lastObject;
}

- (IBAction)reduceButtonAction:(id)sender {
    
    self.productCount--;
    
    self.isIncrease = NO;
    
    [self sendActionsForControlEvents:UIControlEventValueChanged];
}
- (IBAction)increaseButtonAction:(id)sender {
    
    self.productCount++;
    
    self.isIncrease = YES;
    
    [self sendActionsForControlEvents:UIControlEventValueChanged];
}

- (void)setProductCount:(NSInteger)productCount
{
    _productCount = productCount;
    
    self.buyProductNums.text = [NSString stringWithFormat:@"%zd",productCount];
    //设置count=0时,减少按钮和数量隐藏
    self.reduceButton.hidden = !productCount;
    self.buyProductNums.hidden = !productCount;
}

@end
